package com.chinasoft.controller;


import com.chinasoft.pojo.RfmCustomerAnalysis;
import com.chinasoft.pojo.TrafficFunnelConversionAnalysis;
import com.chinasoft.pojo.UserRetentionAnalysis;
import com.chinasoft.result.Result;
import com.chinasoft.service.AnalyzeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("analyze")
@CrossOrigin
public class AnalyzeController {
    
    @Autowired
    private AnalyzeService analyzeService;
    /**
     * 获取RFM客户分析数据
     */
    @GetMapping("rfmCustomerAnalysisData")
    public Result<List<RfmCustomerAnalysis>> getRfmCustomerAnalysisData() {
        List<RfmCustomerAnalysis> rfmCustomerAnalysisData = analyzeService.getAllRfmCustomerAnalysisData();
        return Result.success(rfmCustomerAnalysisData);
    }
    /**
     * 获取流量漏斗转化率数据
     */
    @GetMapping("trafficFunnelConversionAnalysisData")
    public Result<List<TrafficFunnelConversionAnalysis>> getTrafficFunnelConversionAnalysisData() {
        List<TrafficFunnelConversionAnalysis> trafficFunnelConversionAnalysisData = analyzeService.getAllTrafficFunnelConversionAnalysisData();
        return Result.success(trafficFunnelConversionAnalysisData);
    }
    /**
     * 获取用户留存率数据
     */
    @GetMapping("userRetentionAnalysisData")
    public Result<List<UserRetentionAnalysis>> getUserRetentionAnalysisData() {
        List<UserRetentionAnalysis> userRetentionAnalysisData = analyzeService.getAllUserRetentionAnalysisData();
        return Result.success(userRetentionAnalysisData);
    }
}